<?php
require './includes/common.php';
include("./config.php");
$data = array();
class User 
{
public $id;
public $linkname;
public $description;
public $appid;
public $img;
}
$conn = mysqli_connect($dbconfig['host'], $dbconfig['user'], $dbconfig['pwd'],  $dbconfig['dbname']);
/*$conn = mysqli_connect($servername, $username, $password, $mysqlname);*/
$sql = "SELECT * FROM auth_gengduo";
$result = $conn->query($sql);
if($result){
//echo "查询成功";
while ($row = $DB->fetch($result))
{
$user = new User();
$user->id = $row["id"];
$user->linkname= $row["linkname"];
$user->description= $row["description"];
$user->appid= $row["appid"];
$user->img= $row["img"];
$data[]=$user;
}
$json = json_encode($data);//把数据转换为JSON数据.
echo $json;
}else{
echo $json;
}
?>
